/*     */ package com.iris.egrant.web.struts2.tags;
/*     */ 
/*     */ import com.iris.egrant.app.utils.IrisStringUtils;
/*     */ import com.iris.egrant.service.ServiceUtils;
import freemarker.template.Configuration;
/*     */ import freemarker.template.Template;
/*     */ import java.io.Writer;
/*     */ import java.util.ArrayList;
/*     */ import java.util.HashMap;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import javax.servlet.jsp.JspException;
/*     */ import javax.servlet.jsp.tagext.BodyTagSupport;
/*     */ import net.sf.json.JSONSerializer;
/*     */ import org.springframework.context.i18n.LocaleContextHolder;
/*     */ import org.springframework.web.context.WebApplicationContext;
/*     */ import org.springframework.web.context.support.WebApplicationContextUtils;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class TreeBySqlTag
/*     */   extends BodyTagSupport
/*     */ {
/*     */   private static final long serialVersionUID = 1077194066541229822L;
/*  33 */   private String locale = "";
/*     */ 
/*     */   
/*  36 */   private String id = "";
/*     */ 
/*     */   
/*  39 */   private String checkable = "false";
/*     */ 
/*     */   
/*  42 */   private String cacheable = "true";
/*     */   
/*  44 */   private String topCheckbox = "true";
/*     */ 
/*     */   
/*  47 */   private String sql = "";
/*     */   
/*  49 */   private String onClick = "";
/*     */ 
/*     */   
/*  52 */   private String value = "";
/*     */ 
/*     */   
/*  55 */   private List data = new ArrayList();
/*     */ 
/*     */ 
/*     */   
/*  59 */   private String width = "20px;";
/*     */ 
/*     */   
/*  62 */   private String className = "";
/*     */ 
/*     */   
/*  65 */   private String name = "";
/*     */   
/*  67 */   private String label = "";
/*     */ 
/*     */   
/*  70 */   private String selectIcon = "false";
/*     */   
/*     */   public String getOnClick() {
/*  73 */     return this.onClick;
/*     */   }
/*     */   
/*     */   public void setOnClick(String onClick) {
/*  77 */     this.onClick = onClick;
/*     */   }
/*     */ 
/*     */   
/*     */   public List getData() {
/*  82 */     return this.data;
/*     */   }
/*     */ 
/*     */   
/*     */   public void setData(List data) {
/*  87 */     this.data = data;
/*     */   }
/*     */   
/*     */   public String getCacheable() {
/*  91 */     return this.cacheable;
/*     */   }
/*     */   
/*     */   public void setCacheable(String cacheable) {
/*  95 */     this.cacheable = cacheable;
/*     */   }
/*     */   
/*     */   public String getCheckable() {
/*  99 */     return this.checkable;
/*     */   }
/*     */   
/*     */   public void setCheckable(String checkable) {
/* 103 */     this.checkable = checkable;
/*     */   }
/*     */   
/*     */   public String getLocale() {
/* 107 */     if (IrisStringUtils.isNullOrBlank(this.locale)) {
/* 108 */       return LocaleContextHolder.getLocale().toString();
/*     */     }
/* 110 */     return this.locale;
/*     */   }
/*     */   
/*     */   public void setLocale(String locale) {
/* 114 */     this.locale = locale;
/*     */   }
/*     */ 
/*     */   
/*     */   public int doStartTag() throws JspException {
/* 119 */     WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(this.pageContext.getServletContext());
/*     */ 
/*     */     
/* 122 */     Configuration cptFreemarkereConfiguration = (Configuration)context.getBean("cptFreemarkereConfiguration");
/*     */     
/*     */     try {
/* 125 */       String res = (String)this.pageContext.getAttribute("res");
/* 126 */       String ctx = (String)this.pageContext.getAttribute("ctx");
/*     */ 
/*     */       
/* 129 */       Map<String, Object> params = new HashMap<String, Object>();
/* 130 */       params.put("sql", ServiceUtils.encodeToDes3(this.sql.replaceAll("'", "@@")));
/* 131 */       params.put("cacheable", this.cacheable);
/* 132 */       params.put("locale", getLocale());
/*     */       
/* 134 */       Map<String, Object> jsParams = new HashMap<String, Object>();
/*     */       
/* 136 */       jsParams.put("onClick", this.onClick);
/*     */       
/* 138 */       jsParams.put("checkable", this.checkable);
/* 139 */       jsParams.put("topCheckbox", this.topCheckbox);
/*     */       
/* 141 */       Map<String, Object> rootMap = new HashMap<String, Object>();
/* 142 */       rootMap.put("res", res);
/* 143 */       rootMap.put("ctx", ctx);
/* 144 */       rootMap.put("id", this.id);
/* 145 */       rootMap.put("id2", this.id.replaceAll("\\[.*\\]", ""));
/* 146 */       rootMap.put("value", this.value);
/* 147 */       rootMap.put("data", this.data);
/* 148 */       rootMap.put("width", this.width);
/* 149 */       rootMap.put("name", this.name);
/* 150 */       rootMap.put("label", this.label);
/* 151 */       rootMap.put("selectIcon", this.selectIcon);
/*     */       
/* 153 */       rootMap.put("params", JSONSerializer.toJSON(params).toString());
/* 154 */       rootMap.put("jsParams", JSONSerializer.toJSON(jsParams).toString());
/* 155 */       rootMap.put("className", this.className);
/* 156 */       rootMap.put("cleanIcon", (this.className != null && this.className.contains("btn_clean_icon")) ? "Y" : "N");
/* 157 */       Template template = cptFreemarkereConfiguration.getTemplate("treeBySql.ftl", "utf-8");
/*     */       
/* 159 */       template.process(rootMap, (Writer)this.pageContext.getOut());
/*     */     }
/* 161 */     catch (Exception e) {
/* 162 */       throw new JspException(e);
/*     */     } 
/*     */     
/* 165 */     return 0;
/*     */   }
/*     */ 
/*     */   
/*     */   public String getId() {
/* 170 */     return this.id;
/*     */   }
/*     */ 
/*     */   
/*     */   public void setId(String id) {
/* 175 */     this.id = id;
/*     */   }
/*     */   
/*     */   public String getValue() {
/* 179 */     return this.value;
/*     */   }
/*     */   
/*     */   public void setValue(String value) {
/* 183 */     this.value = value;
/*     */   }
/*     */   
/*     */   public String getSql() {
/* 187 */     return this.sql;
/*     */   }
/*     */   
/*     */   public void setSql(String sql) {
/* 191 */     this.sql = sql;
/*     */   }
/*     */   
/*     */   public String getWidth() {
/* 195 */     return this.width;
/*     */   }
/*     */   
/*     */   public void setWidth(String width) {
/* 199 */     this.width = width;
/*     */   }
/*     */   
/*     */   public String getClassName() {
/* 203 */     return this.className;
/*     */   }
/*     */   
/*     */   public void setClassName(String className) {
/* 207 */     this.className = className;
/*     */   }
/*     */   
/*     */   public String getName() {
/* 211 */     return this.name;
/*     */   }
/*     */   
/*     */   public void setName(String name) {
/* 215 */     this.name = name;
/*     */   }
/*     */   
/*     */   public String getLabel() {
/* 219 */     return this.label;
/*     */   }
/*     */   
/*     */   public void setLabel(String label) {
/* 223 */     this.label = label;
/*     */   }
/*     */   
/*     */   public String getTopCheckbox() {
/* 227 */     return this.topCheckbox;
/*     */   }
/*     */   
/*     */   public void setTopCheckbox(String topCheckbox) {
/* 231 */     this.topCheckbox = topCheckbox;
/*     */   }
/*     */   
/*     */   public String getSelectIcon() {
/* 235 */     return this.selectIcon;
/*     */   }
/*     */   
/*     */   public void setSelectIcon(String selectIcon) {
/* 239 */     this.selectIcon = selectIcon;
/*     */   }
/*     */ }


/* Location:              D:\文件kjt\WEB-INF\lib\egrant-core-2.2.20240205.1659.jar!\com\iris\egrant\web\struts2\tags\TreeBySqlTag.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */